<%@ page import="ro.gateway.aida.utils.HttpUtils,
                 ro.gateway.aida.obj.db.ActivityDB,
                 java.util.Hashtable,
                 ro.gateway.aida.servlet.EditActivityServlet,
                 java.text.SimpleDateFormat,
                 java.util.Date,
                 ro.gateway.aida.obj.*,
                 ro.gateway.aida.usr.UserDB,
                 ro.gateway.aida.usr.Arbiter,
                 ro.gateway.aida.usr.Perms,
                 ro.gateway.aida.fnd.FundingItem,
                 ro.gateway.aida.usr.User,
				 ro.gateway.aida.usr.UserUtils,
                 ro.xblue.translator.*,
                 ro.gateway.aida.db.PersistenceManager,
                 ro.gateway.aida.admin.ActObjsOptsConst,
                 ro.gateway.aida.admin.ActivityObjectsOptions,
                 ro.gateway.aida.db.PersistenceToken
                 ,
                 ro.gateway.aida.utils.Utils,
			  java.util.ArrayList,
			  ro.gateway.aida.admin.PropertyListItem"%>
<%@ taglib uri="/WEB-INF/translator.tld" prefix="trans" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<trans:initPage module="prj_pages" />
<%
	// parameters
	long id = HttpUtils.getLong(request, "id", -1);
	if (id == -1) {
		Long l = ((Long)request.getAttribute("project_id"));
		id = (l != null) ? l.longValue() : -1;
	}
	boolean show_close_button = request.getAttribute("pview_hideclose") == null;
	LanguageBean lang_bean = TranslatorUtils.getCurrentLanguage(request, application);
//	System.out.println("current_lang:" + lang_bean.language );

	//
	Activity bean = null;
	long time = 0;
	if (id != -1) {
		bean = ActivityDB.getManager(PersistenceManager.tokenLookup(application)).
		getAllDataById(id);
		if (bean != null) {
			bean.setView_lang(lang_bean.language);
		}
	}
	if (bean == null) {
		Hashtable ed_ctx = (Hashtable) request.getAttribute(EditActivityServlet.PNAME_R_CTX);
		if (ed_ctx != null) {
			bean = (Activity) ed_ctx.get(EditActivityServlet.PNAME_BEAN);
		}
		if (bean == null) {
			return;
		}
	}

	// misc
	String ctx = request.getContextPath();
	Translator translator = (Translator) application.
		getAttribute(TranslatorConstants.BLUE_TRANSLATOR);
	Translator_DB translator_db = (Translator_DB) application.
		getAttribute(TranslatorConstants.DB_TRANSLATOR);

	String unspecified = null;
	if (translator != null) {
		unspecified = translator.
		getMessage(lang_bean.language, "prj_pages", "p7.unsp");
	} else if (translator_db != null) {
		if (session.getAttribute( ShowEditButtonAction.FLAG ) != null) {
			unspecified = ShowPageMessageTag.get_linked_message(pageContext,"p7.unsp");
		} else {
			unspecified = ShowPageMessageTag.get_message(pageContext,"p7.unsp");
		}
	}
	if (unspecified == null) unspecified = "p7.unsp";

	User user = UserUtils.getLogged(request,response);
	UserDB udb = UserDB.getManager(PersistenceManager.tokenLookup(application));
	long owner_id= udb.getOwner(id, Arbiter.PROJECT_TYPE);

	String user_id=request.getParameter("user_id");
	String event_id=request.getParameter("event_id");
	String print=request.getParameter("print");
	PersistenceToken token = PersistenceManager.tokenLookup( application );

	if (bean == null) {
		response.sendError(HttpServletResponse.SC_NOT_FOUND, "Project not found");
		return;
	}
	Arbiter ar=Arbiter.getManager(token);
%>
<script>
function om(val) {
	if(val==0) document.approveform.optionmade.value='no';
	document.approveform.submit();
};
function tglreason(tgl) {
	document.approveform.reason.disabled=tgl;
	if (tgl==0) document.approveform.reason.value='TYPE REASON HERE!';
	else document.approveform.reason.value='';
};
</script>

<!-- TIME:<%=time%> -->
<% if(user_id!=null && event_id!=null && ar.canDo(request, Perms.OBJECT_APPROVE)) {%>


<TABLE cellSpacing=1 cellPadding=5 width="70%" background=<%=ctx%>/images/pixelbgtable.gif align="center" class="text">
 <TR background=<%=ctx%>/images/pixelbgtable.gif>
   <TD class=text_searchbold align=center><font color="#FFFF00"><b><trans:showPageMessage label="pview.prjapproval" /></b></font></td>
  </tr>
 <tr bgColor=#ffffff>
 <td class=text_search><trans:showPageMessage label="pview.plsreview" />
 <!--Please review the project information and then approve or reject the project.<br>
If you reject the project, please complete a reason for rejecting it. This will
be included in the alert that project's owner will receive.-->
<form method=POST name=approveform action="<html:rewrite page='/approve.do'/>">

    <input type=hidden name="user_id" value=<%=user_id%> />
    <input type=hidden name="event_id" value=<%=event_id%> />
    <input type=hidden name="id" value="<%=id%>" />
    <input type=hidden name="optionmade" value="yes" />
	<table class=text align=center>
	<tr>
	<td align=right>
	<b><trans:showPageMessage label="pview.approve" /></b><input type="radio" onclick="javascript:tglreason(1);" name="approve" value="yes"/>
	<b><trans:showPageMessage label="pview.reject" /></b><input type="radio" onclick="javascript:tglreason(0);" name="approve" value="no"/>
	</td>
	<td>
	<trans:showPageMessage label="pview.reasonforrejection" />:<br><textarea name=reason cols=50 rows=3 disabled=1 onkeydown="textCounter(this.form.reason,this.form.creason,3000);" onkeyup="textCounter(this.form.reason,this.form.creason,3000);"></textarea> 
	<input readonly type="text" name="creason" size="3" maxlength="4" value=""> <trans:showPageMessage label="charactersleft" />
	</td>
	</tr>
	<tr><td width="50%">
	<trans:showPageMessage label="pview.based" />
	<!--Based on the quantity and the quality of information provided, please rate the content
	for this project-->
	</td>
	<td>
	<select name="feedback">
	<option value="1"><trans:showPageMessage label="pview.poor" hide_link="true" /></option>
	<option value="2" selected><trans:showPageMessage label="pview.good" hide_link="true" /></option>
	<option value="3"><trans:showPageMessage label="pview.excellent" hide_link="true" /></option>
	</select>
	</td>
	</tr>
	</table>
	<br>
    <input class=buton type=button size=10 value="OK" onclick="javascript:om(1);"/>
    <input class=buton type=button value="CANCEL" onclick="javascript:om(0);"/>
</form>
</td>
</tr>
</table>
<p>
<%}%>
<table align="left" bgcolor="#FFFFFF" cellpadding=2>
<script language="javascript">
     function delproj(id) {
          if (!confirm('Realy delete?')) {
               return;
          }
          document.fdelproj.id.value = id;
          document.fdelproj.submit();
     }
</script>
<tr><% if (!"yes".equals(print) && show_close_button && ar.canDo(request,Perms.EDIT_OBJECT,bean.getId(),Arbiter.PROJECT_TYPE)) {%>
<td>
<form class=text method=POST action="<%=ctx%>/editActivity?edtype=ed&id=<%=id%>">
<input class='buton' type='submit' value='<trans:showPageMessage label="pview.edproj" hide_link="true"/>'/>
</form>
</td><td>
<form class=text method=POST action="<%=ctx%>/activity/del.project.do" name="fdelproj">
<input type="hidden" name="id" value="-1"/>
<input class='buton' type='button' onclick="javascript:delproj('<%=id%>');" value='<trans:showPageMessage label="pview.delproj" hide_link="true" />'/>
</form>
</td>
<% } %>
<% if (!"yes".equals(print) && show_close_button && user!=null) {%>
<td>
<form class=text method=POST action="<%=ctx%>/sendbymail.do?mode=form">
<input class=buton type=submit value='<trans:showPageMessage label="pview.sendbyemail" hide_link="true"/>' />
<input type=hidden name=prjid value="<%=id%>"/>
</form></td><td valign="top">
<form class=text method=POST action="<%=ctx%>/bookmark.do?mode=insert">
<input class=buton type=submit value='<trans:showPageMessage label="pview.addtomybookmarks" hide_link="true"/>' />
<input type=hidden name="objectid" value=<%=bean.getId()%> />
<input type=hidden name="mode" value="insert" />
<input type=hidden name="booktype" value="1" />
</form></td>
<td valign=top>
<input type=button class=buton value='<trans:showPageMessage label="pview.printerfriendly" hide_link="true"/>' onclick="javascript:window.location.href='<%=ctx%>/activity/view.jsp?id=<%=id%>&print=yes';"/>
<%}%></td>
</tr></table><br clear=all>
<trans:showPageMessage label="translator.showhiddentags"/>
<TABLE class="text" cellSpacing=1 cellPadding=5 width="100%" background=<%=ctx%>/images/pixelbgtable.gif align="center">
<%// there is no bean %>
<% if (bean == null) { %>
     <TR bgColor=#ffffff>
          <TD colspan="2" class=text_search>

               <trans:showPageMessage label="pview.no_project" />
          </TD>
     </TR>
</table>
</body>
</html>
<% return; } %>
<%// there is no bean %>


            <TR bgColor=#336699><td width=20% background=<%=ctx%>/images/pixelbgtable.gif class=textalb><div align=center><trans:showPageMessage label="pview.prjdet" /></div></td>
                  <TD class=text_bold align=center><font color="#FFFF00">
                  <%if (bean.getTitle(lang_bean.language) != null) {%>
                  	<%=bean.getTitle(lang_bean.language)%>
                  <%} else { %>
	               <trans:showPageMessage label="p7.unsp" />
	               <%}%>
                  </font></TD>
            </TR>

     <%// donor ids%>
     <%
          OrganizationInv[] donor_orgs = bean.getOrgsByLRId(OrganizationRole.DONOR_ORG_ROLE);
          if (donor_orgs == null) donor_orgs = new OrganizationInv[0];
     %>
     <% if (donor_orgs.length > 0) { %>
     <TR bgColor=#ffffff>
          <TD width="20%" class=text_searchbold valign="top">
               <img src=<%=ctx%>/images/arrow_blue.gif hspace=4><trans:showPageMessage label="md.identif" /><br>
               <trans:showPageMessage label="p.iddproj" />
          </TD>
          <TD width="80%" class=text_search valign="top">
               <% for (int i = 0; i < donor_orgs.length; i++) { %>
                    <%
                    String donor_id = bean.getDonorIdForOrg(donor_orgs[i].getOrg().getId());
                    if (donor_id == null) donor_id = "";
                    %>
                    <trans:showPageMessage label="p.org" /> 
                    <a href=# onclick="javascript:window.open('<%=ctx%>/org/view?id=<%=donor_orgs[i].getOrg().getId()%>', 'org_viewer', 'status=yes,WIDTH=425,HEIGHT=400,SCROLLBARS=yes');">

                  <%=donor_orgs[i].getOrg().getName().getString(lang_bean.language)%> </a>
                    
                    : <%=donor_id%>
                    <br>
               <% } %>
               <% if (donor_orgs.length == 0) { %>
                  <trans:showPageMessage label="p7.unsp" />
               <% } %>
          </TD>
     </TR>
     <% } %>

     <%// planning %>
     <%
          SimpleDateFormat date_formatter = new SimpleDateFormat("dd/MM/yyyy");
     %>
     <TR bgColor=#ffffff>
          <TD width="20%" class=text_searchbold valign="center">
               <img src=<%=ctx%>/images/arrow_blue.gif hspace=4>
               <b><trans:showPageMessage label="p.plan" /></b>
          </TD>
          <TD width="80%" class=text_search valign="top">
               <%if(bean.getDate_pa() != -1) {%>
               <trans:showPageMessage label="p.dprop" />:
               <%=date_formatter.format(new java.util.Date(bean.getDate_pa()))%>
               <br>
               <%}%>

               <%if(bean.getDate_aa() != -1) {%>
               <trans:showPageMessage label="p.dapp" />:
               <%=date_formatter.format(new java.util.Date(bean.getDate_aa()))%>
               <br>
               <%}%>

               <%if(bean.getDate_ps() != -1) {%>
               <trans:showPageMessage label="p.pstart" />:
               <%=date_formatter.format(new java.util.Date(bean.getDate_ps()))%>
               <br>
               <%}%>

               <%if(bean.getDate_as() != -1) {%>
               <trans:showPageMessage label="p.sdate" />:
               <%=date_formatter.format(new java.util.Date(bean.getDate_as()))%>
               <br>
               <%}%>

               <hr size="1">

               <%if(bean.getDate_pe() != -1) {%>
               <trans:showPageMessage label="p.endpdate" />:
               <%=date_formatter.format(new java.util.Date(bean.getDate_pe()))%>
               <br>
               <%}%>

               <%if(bean.getDate_ae() != -1) {%>
               <trans:showPageMessage label="p.enddate" />:
               <%=date_formatter.format(new java.util.Date(bean.getDate_ae()))%>
               <br>
               <%}%>


               <% if (bean.getDate_ext() != -1) { %>
                    <trans:showPageMessage label="p.projext" />:
                         <%=date_formatter.format(new Date(bean.getDate_ext()))%>
                    <% if (bean.getExtensionReason(lang_bean.language) != null) { %>
                         <br>
                         <trans:showPageMessage label="p.extr" />:<br>
                         <%=bean.getExtensionReason(lang_bean.language)%>
                    <% } %>
                    <hr size="1">
               <% } %>

               <%
                     ActivityStatus act_status = bean.getStatus();
               %>
               <% if (act_status != null) { %>
               <p>
              <trans:showPageMessage label="p.status" /> : <%=act_status.getStatus(lang_bean.language)%>
              <% if (bean.getStatusReason(lang_bean.language) != null) { %>
              <br><%=bean.getStatusReason(lang_bean.language)%>
              <% } %>
              </p>
              <% } %>
          </TD>
     </TR>

     <%// location %>
     <%
          AIDALocation[] locations = bean.getLocations();
          if (locations == null) locations = new AIDALocation[0];
     %>
     <% if (locations.length > 0) { %>
     <TR bgColor=#ffffff>
          <TD width="20%" class=text_searchbold valign="center">
               <img src=<%=ctx%>/images/arrow_blue.gif hspace=4>
               <b><trans:showPageMessage label="p2.titlu" /></b>
          </TD>
          <TD width="80%" class=text_search valign="top">
               <trans:showPageMessage label="p2.is" />:
               <% if (bean.isInternational()) { %>
                    <trans:showPageMessage label="p2.international" />
               <% } else { %>
                    <trans:showPageMessage label="p2.national" />
               <% } %><br>
               <trans:showPageMessage label="p2.transfrontalier" />:
               <% if (bean.isTransfrontalier()) { %>
                    <trans:showPageMessage label="proj.da" />
               <% } else { %>
                    <trans:showPageMessage label="proj.nu" />
               <% } %>

               <br><br>
               <trans:showPageMessage label="md.loclist" />:<br>
               <%=(locations.length > 0) ? "" : unspecified%>
			<% int last_region = -1; %>
			<% for (int i = 0; i < locations.length; i++) { %>
				<% if (last_region == -1 || locations[i].getCregion_id() != last_region) { %>
				   <b>[<%=locations[i].getCregion().getName()%>]</b><br/>
				<% } %>
				<% if (locations[i].getCountry() != null) { %>
				   &nbsp;&nbsp;&nbsp;&rarr;&nbsp; [<%=locations[i].getCountry().getName()%>]
				<% } %>
				<% if (locations[i].getRegion() != null) { %>
				- <%=locations[i].getRegion().getName()%>
				<% } %>
				<% if (locations[i].getJudet() != null) { %>
				- <%=locations[i].getJudet().getName()%>
				<% } %>
				<% if (locations[i].getOras() != null) { %>
				- <%=locations[i].getOras().getName()%>
				<% } %>
				<% if (locations[i].getLocalitate() != null) { %>
				- <%=locations[i].getLocalitate().getName()%>
				<% } %>
				<br/>
			<% last_region = locations[i].getCregion_id(); %>
			<% } %>
          </TD>
     </TR>
     <% } %>

     <%// sectors  %>
     <%
          AIDAObjSector[] sectors = bean.getSectors();
          if (sectors == null) sectors = new AIDAObjSector[0];
     %>
     <% if (sectors.length > 0) { %>
     <TR bgColor=#ffffff>
          <TD width="20%" class=text_searchbold valign="center">
               <img src=<%=ctx%>/images/arrow_blue.gif hspace=4>
               <b><trans:showPageMessage label="p2.sector" /></b>
          </TD>
          <TD width="80%" class=text_search valign="top">
               <trans:showPageMessage label="pview.seclist" />:<br>
               <%=(sectors.length > 0) ? "" : unspecified%>
               <% for (int i = 0; i < sectors.length; i++) { %>
                  &middot;&nbsp;<%=sectors[i].getSector().getTitle().getString(lang_bean.language)%>
                  <% if (sectors[i].getSubsector() != null) { %>
                  - <%=sectors[i].getSubsector().getTitle().getString(lang_bean.language)%>
                  <% } %>
                  <% if (sectors[i].getSubsector1() != null) { %>
                  - <%=sectors[i].getSubsector1().getTitle().getString(lang_bean.language)%>
                  <% } %>
                  <br>
               <% } %>
          </TD>
     </TR>
     <% } %>

     <% Category[] cats = bean.getCategoriesArray(); %>
     <% if (cats != null && cats.length > 0) { %>
     <TR bgColor=#ffffff>
          <TD width="20%" class=text_searchbold valign="center">
               <img src=<%=ctx%>/images/arrow_blue.gif hspace=4>
               <b><trans:showPageMessage label="p2.cats" /></b>
          </TD>
          <TD width="80%" class=text_search valign="top">
            <% for (int i = 0; i < cats.length; i++) { %>
                  &middot;&nbsp;&nbsp;<%=cats[i].getName().getString(lang_bean.language)%>
                  <br>
            <% } %>
          </TD>
     </TR>
     <% } %>

     <%// components  %>
     <%
          GenericActivityProperty[] components = bean.getComponents();
          if (components == null) components = new GenericActivityProperty[0];
     %>
     <% if (components.length > 0) { %>
     <TR bgColor=#ffffff>
          <TD width="20%" class=text_searchbold valign="top">
               <img src=<%=ctx%>/images/arrow_blue.gif hspace=4>
               <b><trans:showPageMessage label="md.comp" /></b>
          </TD>
          <TD width="80%" class=text_search valign="top">
               <trans:showPageMessage label="pview.complist" />:<br>
               <%=(components.length > 0) ? "" : unspecified%>
               <% for (int i = 0; i < components.length; i++) { %>
                    &middot;&nbsp;<%=components[i].getName(lang_bean.language)%>
                    <br>
               <% } %>
          </TD>
     </TR>
     <% } %>

     <%// components  %>
     <%
          OrganizationInv[] forgs = bean.
                 getOrgsByLRId(OrganizationRole.FINANCING_ORG_ROLE);
          PersonInv[] fpers = bean.
                 getPersonsByLRId(OrganizationRole.FINANCING_ORG_ROLE);
          FundingItem[] fitems = bean.getFunding_itemsArray();
          if (forgs == null) forgs = new OrganizationInv[0];
          if (fpers == null) fpers = new PersonInv[0];
          if (fitems == null) fitems = new FundingItem[0];
     %>
     <% if (forgs.length > 0) { %>
     <TR bgColor=#ffffff>
          <TD width="20%" class=text_searchbold valign="top">
               <img src=<%=ctx%>/images/arrow_blue.gif hspace=4>
               <b><trans:showPageMessage label="pview.ftitle" /></b>
          </TD>
          <TD width="80%" class=text_search valign="top">
            <%request.setAttribute("__activity", bean);%>
            <jsp:include page="/fnd2/fnd_orgs_disp.jsp" />
		  <u><trans:showPageMessage label="total.budget" /></u>:<br/>
		  <%=bean.getProjectBudgetAsString(lang_bean.locale, "<br/>")%>
          </TD>
     </TR>
     <% } %>

     <%// relations  %>
     <%
          ActivityRelation[] relations = bean.getAct_relationsArray();
          if (relations == null) relations = new ActivityRelation[0];
     %>
     <% if (relations.length > 0) { %>
     <TR bgColor=#ffffff>
          <TD width="20%" class=text_searchbold valign="top">
               <img src=<%=ctx%>/images/arrow_blue.gif hspace=4>
               <trans:showPageMessage label="md.prel" />
          </TD>
          <TD width="80%" class=text_search valign="top">
               <trans:showPageMessage label="pview.complist" />:<br>
               <%=(relations.length > 0) ? "" : unspecified%>
               <% for (int i = 0; i < relations.length; i++) { %>
                    <%
                    GenericActivityProperty name = relations[i].getRelToTitle();
                    %>
                    &middot;&nbsp;
                    <a href="<%=ctx%>/activity/view.jsp?id=<%=relations[i].getRelto_activity_id()%>" >
                    <%=(name != null) ? name.getName(lang_bean.language) : "x"%> </a> :
				<trans:showPageMessage label='<%=relations[i].getRelation()%>' />
                    <br>
               <% } %>
          </TD>
     </TR>
     <% } %>

     <%// contracting institutions  %>
     <%
          OrganizationInv[] corgs = bean.
                 getOrgsByLRId(OrganizationRole.CONTRACTING_ORG_ROLE);
          PersonInv[] cpers = bean.
                 getPersonsByLRId(OrganizationRole.CONTRACTING_ORG_ROLE);
          if (cpers == null) cpers = new PersonInv[0];
          if (corgs == null) corgs = new OrganizationInv[0];
     %>
     <% if (cpers.length + corgs.length > 0) { %>
     <TR bgColor=#ffffff>
          <TD width="20%" class=text_searchbold valign="center">
               <img src=<%=ctx%>/images/arrow_blue.gif hspace=4>
               <b><trans:showPageMessage label="md.cauth" /></b>
          </TD>
          <TD width="80%" class=text_search valign="top">
            <% if (corgs.length > 0) { %>
               <trans:showPageMessage label="p7.orgs" />:<br>
               <%=(corgs.length > 0) ? "" : unspecified%>
               <% for (int i = 0; i < corgs.length; i++) { %>
                  <% Organization _org = corgs[i].getOrg(); %>
                  <% if (_org == null) { %>
                    &middot;Inconsistent data! (org_id:<%=corgs[i].getOrg_id()%> not found).
                  <% } else { %>
                    &middot;&nbsp;
                                        <a href=# onclick="javascript:window.open('<%=ctx%>/org/view?id=<%=corgs[i].getOrg().getId()%>', 'org_viewer', 'status=yes,WIDTH=400,HEIGHT=425,SCROLLBARS=yes');">
                    <%=corgs[i].getOrg().getName().getString(lang_bean.language)%></a>
                    <br>
                  <% } %>
               <% } %>
               <br>
            <% } %>

            <% if (cpers.length > 0) { %>
               <trans:showPageMessage label="p7.pers" />:<br>
               <%=(cpers.length > 0) ? "" : unspecified%>
               <% for (int i = 0; i < cpers.length; i++) { %>
                    &middot;&nbsp;
                    <a href=# onclick="javascript:window.open('<%=ctx%>/pers/view?id=<%=cpers[i].getPerson().getId()%>', 'pers_viewer', 'status=yes,WIDTH=400,HEIGHT=400,SCROLLBARS=yes');">
                    <%=cpers[i].getPerson().getName()%></a>
                    <br>
               <% } %>
               <br>
            <% } %>
          </TD>
     </TR>
     <% } %>

     <%// beneficiaries %>
     <%
          OrganizationInv[] borgs = bean.
                 getOrgsByLRId(OrganizationRole.BENEFICIARS_ORG_ROLE);
          PersonInv[] bpers = bean.
                 getPersonsByLRId(OrganizationRole.BENEFICIARS_ORG_ROLE);
          if (bpers == null) bpers = new PersonInv[0];
          if (borgs == null) borgs = new OrganizationInv[0];
     %>
     <% if (bpers.length + borgs.length>0) { %>
     <TR bgColor=#ffffff>
          <TD width="20%" class=text_searchbold valign="top">
               <img src=<%=ctx%>/images/arrow_blue.gif hspace=4>
               <b><trans:showPageMessage label="md.ben" /></b>
          </TD>
          <TD width="80%" class=text_search valign="top">
            <% if (borgs.length > 0) { %>
               <trans:showPageMessage label="p7.orgs" />:<br>
               <%=(borgs.length > 0) ? "" : unspecified%>
               <% for (int i = 0; i < borgs.length; i++) { %>
                    &middot;&nbsp;<a href=# onclick="javascript:window.open('<%=ctx%>/org/view?id=<%=borgs[i].getOrg().getId()%>', 'org_viewer', 'status=yes,WIDTH=400,HEIGHT=400,SCROLLBARS=yes');">
                    <%=borgs[i].getOrg().getName().getString(lang_bean.language)%></a>
                    <br>
               <% } %>
               <br>
            <% } %>

            <% if (bpers.length > 0) { %>
               <trans:showPageMessage label="p7.pers" />:<br>
               <%=(bpers.length > 0) ? "" : unspecified%>
               <% for (int i = 0; i < bpers.length; i++) { %>
                    &middot;&nbsp;
                     <a href=# onclick="javascript:window.open('<%=ctx%>/pers/view?id=<%=bpers[i].getPerson().getId()%>', 'pers_viewer', 'status=yes,WIDTH=400,HEIGHT=400,SCROLLBARS=yes');">
                    <%=bpers[i].getPerson().getName()%></a>
                    <br>
               <% } %>
               <br>
            <% } %>
          </TD>
     </TR>
     <% } %>

     <%// description and objectives %>
     <%
     %>
     <% if ((bean.getResult(lang_bean.language) != null) || ((bean.getDescription(lang_bean.language) != null) || (bean.getObjective(lang_bean.language) != null))) { %>
     <TR bgColor=#ffffff>
          <TD width="20%" class=text_searchbold valign="center">
               <img src=<%=ctx%>/images/arrow_blue.gif hspace=4>
               <b><trans:showPageMessage label="md.descobj" /></b>
          </TD>
          <TD width="80%" class=text_search valign="top" align="center">
               <table width="90%" cellpadding="5" cellspacing="1" border="0" bgcolor="AAAAAA">
               <% if (bean.getDescription(lang_bean.language) != null) { %>
                    <tr>
                         <td bgcolor="#f2f2f2" width="30%" class="text_search" align="right">
                         <trans:showPageMessage label="p5.descprj" /> :
                         </td>
                         <td bgcolor="#FFFFFF" width="70%" class="text_search">
                         <%=bean.getDescription(lang_bean.language) != null ? bean.getDescription(lang_bean.language) : unspecified%>
                         </td>
                    </tr>
               <% } %>
               <% if (bean.getObjective(lang_bean.language) != null) { %>
                    <tr>
                         <td bgcolor="#F2f2f2" width="30%" class="text_search" align="right">
                         <trans:showPageMessage label="p5.primobj" /> :
                         </td>
                         <td bgcolor="#FFFFFF" width="70%" class="text_search">
                         <%=bean.getObjective(lang_bean.language) != null ? bean.getObjective(lang_bean.language) : unspecified%>
                         </td>
                    </tr>
               <% } %>
               <% if (bean.getResult(lang_bean.language) != null) { %>
                    <tr>
                         <td bgcolor="#F2f2f2" width="30%" class="text_search" align="right">
                         <trans:showPageMessage label="p5.rezprj" /> :
                         </td>
                         <td bgcolor="#FFFFFF" width="70%" class="text_search">
                         <%=bean.getResult(lang_bean.language) != null ? bean.getResult(lang_bean.language) : unspecified%>
                         </td>
                    </tr>
               <% } %>
               </table>
          </TD>
     </TR>
     <% } %>

     <%// keywords %>
     <%
     %>
     <% if (bean.getKeywords(lang_bean.language) != null) { %>
     <TR bgColor=#ffffff>
          <TD width="20%" class=text_searchbold valign="top">
               <img src=<%=ctx%>/images/arrow_blue.gif hspace=4>
               <b><trans:showPageMessage label="md.keywords" /></b>
          </TD>
          <TD width="80%" class=text_search valign="top">
          <%=bean.getKeywords(lang_bean.language) != null ? bean.getKeywords(lang_bean.language) : unspecified%>
          </TD>
     </TR>
     <% } %>

	<% ArrayList benz = bean.getBeneficiaries(); %>
     <% if ((benz != null && benz.size() > 0) || (bean.getBencomment(lang_bean.language) != null)) { %>
     <TR bgColor=#ffffff>
          <TD width="20%" class=text_searchbold valign="top">
               <img src=<%=ctx%>/images/arrow_blue.gif hspace=4>
               <b><trans:showPageMessage label="md.beneficiaries" /></b>
          </TD>
          <TD width="80%" class=text_search valign="top">
		<% for (int i = 0; (benz != null) && i < benz.size(); i++) { %>
			<%=((PropertyListItem)benz.get(i)).getString(lang_bean.language)%>
			<br/>
		<% } %>
		<% if (bean.getBencomment(lang_bean.language) != null) { %>
		<u><b>Comments:</b></u><br/>
		<%=bean.getBencomment(lang_bean.language)%>
		<% } %>
          </TD>
     </TR>
     <% } %>

     <%// data source institutions %>
     <%
          OrganizationInv[] ds_orgs = bean.
                 getOrgsByLRId(OrganizationRole.DATASOURCE_ORG_ROLE);
          if (ds_orgs == null) ds_orgs = new OrganizationInv[0];
     %>
     <% if (ds_orgs.length>0) { %>
     <TR bgColor=#ffffff>
          <TD width="20%" class=text_searchbold valign="top">
               <img src=<%=ctx%>/images/arrow_blue.gif hspace=4>
               <b><trans:showPageMessage label="p.sourceinst" /></b>
          </TD>
          <TD width="80%" class=text_search valign="top">
               <trans:showPageMessage label="p7.orgs" />:<br>
               <% for (int i = 0; i < ds_orgs.length; i++) { %>
                    &middot;&nbsp;<a href=# onclick="javascript:window.open('<%=ctx%>/org/view?id=<%=ds_orgs[i].getOrg().getId()%>', 'org_viewer', 'status=yes,WIDTH=400,HEIGHT=400,SCROLLBARS=yes');">
                    <%=ds_orgs[i].getOrg().getName().getString(lang_bean.language)%></a>
                    <br>
               <% } %>
               <br>
          </TD>
     </TR>
     <% } %>

     <%// Other person involved %>
     <%
          PersonInv[] opers = bean.
                 getPersonsByLRId(OrganizationRole.NO_ROLE);
          if (opers == null) opers = new PersonInv[0];
     %>
     <% if (opers.length > 0) { %>
     <TR bgColor=#ffffff>
          <TD width="20%" class=text_searchbold valign="top">
               <img src=<%=ctx%>/images/arrow_blue.gif hspace=4>
               <b><trans:showPageMessage label="p6.labelpers" /></b>
          </TD>
          <TD width="80%" class=text_search valign="top">
               <%=(opers.length > 0) ? "" : unspecified%>
               <% for (int i = 0; i < opers.length; i++) { %>
                    &middot;&nbsp;
                     <a href=# onclick="javascript:window.open('<%=ctx%>/pers/view?id=<%=opers[i].getPerson().getId()%>', 'pers_viewer', 'status=yes,WIDTH=400,HEIGHT=400,SCROLLBARS=yes');">
                    <%=opers[i].getPerson().getName()%></a>
                    <br>
               <% } %>
          </TD>
     </TR>
     <% } %>

      <% ActivityObjectsOptions aoo = ActivityObjectsOptions.getInstance(); %>
      <% if (aoo.isEnabled(ActObjsOptsConst.PROJECT_CNAME)
      ||aoo.isEnabled(ActObjsOptsConst.PROJECT_CTITLE)
      ||aoo.isEnabled(ActObjsOptsConst.PROJECT_CEMAIL)
      ||aoo.isEnabled(ActObjsOptsConst.PROJECT_CCOUNTRY)
      ||aoo.isEnabled(ActObjsOptsConst.PROJECT_CADDR1)
      ||aoo.isEnabled(ActObjsOptsConst.PROJECT_CADDR2)
      ||aoo.isEnabled(ActObjsOptsConst.PROJECT_CPZIP)
      ||aoo.isEnabled(ActObjsOptsConst.PROJECT_CPHONE)
      ||aoo.isEnabled(ActObjsOptsConst.PROJECT_CURL)) { %>
      <% if (aoo.isEnabled(ActObjsOptsConst.PROJECT_CNAME)) { %>
      <TR bgColor=#ffffff>
            <TD width="20%" class=text_searchbold valign="center">
                  <img src=<%=ctx%>/images/arrow_blue.gif hspace=4>
                  <b><trans:showPageMessage label="p6.labelcont" /></b>
            </TD>
            <TD width="80%" class=text_search valign="top">
                  <% ContactInfo cinfo = bean.getContact(); %>
                  <% if (aoo.isEnabled(ActObjsOptsConst.PROJECT_CNAME)) { %>
                  Contact name: <%=cinfo.getcName() != null ? cinfo.getcName() : unspecified%>
                  <br/>
                  <% } %>
                  <% if (aoo.isEnabled(ActObjsOptsConst.PROJECT_CTITLE)) { %>
                  Contact title: <%=cinfo.getcTitle() != null ? cinfo.getcTitle() : unspecified%>
                  <br/>
                  <% } %>
                  <% if (aoo.isEnabled(ActObjsOptsConst.PROJECT_CEMAIL)) { %>
                  Email:
                  <% if (cinfo.getcEmail() == null) { %>
                        <%=unspecified%>
                  <% } else { %>
                        <a href="mailto:<%=cinfo.getcEmail()%>"><%=cinfo.getcEmail()%></a>
                  <% } %>
                  <br/>
                  <% } %>
                  <% if (aoo.isEnabled(ActObjsOptsConst.PROJECT_CADDR1)) { %>
                  Address 1: <%=cinfo.getAddr1() != null ? cinfo.getAddr1() : unspecified%>
                  <br/>
                  <% } %>
                  <% if (aoo.isEnabled(ActObjsOptsConst.PROJECT_CADDR2)) { %>
                  Address 2: <%=cinfo.getAddr2() != null ? cinfo.getAddr2() : unspecified%>
                  <br/>
                  <% } %>
                  <% if (aoo.isEnabled(ActObjsOptsConst.PROJECT_CPZIP)) { %>
                  Zip: <%=cinfo.getPostalZip() != null ? cinfo.getPostalZip() : unspecified%>
                  <br/>
                  <% } %>
                  <% if (aoo.isEnabled(ActObjsOptsConst.PROJECT_CCOUNTRY)) { %>
                  Country: <%=cinfo.getCountry_iso3() != null ? cinfo.getCountry_iso3() : unspecified%>
                  <br/>
                  <% } %>
                  <% if (aoo.isEnabled(ActObjsOptsConst.PROJECT_CPHONE)) { %>
                  Phone/Fax: <%=cinfo.getcPhone() != null ? cinfo.getcPhone() : unspecified%>
                  <br/>
                  <% } %>
                  <% if (aoo.isEnabled(ActObjsOptsConst.PROJECT_CURL)) { %>
                  URL:
                  <% if (cinfo.getcURL() == null) { %>
                        <%=unspecified%>
                  <% } else { %>
                        <a href="<%=cinfo.getcURL()%>"><%=cinfo.getcURL()%></a>
                  <% } %>
                  <% } %>
            </TD>
      </TR>
      <% } // contact item%>
      <% } // contacts %>



     <%// relevant documents %>
     <%
          AIDADocument[] docs = bean.getDocuments();
          if (docs == null) docs = new AIDADocument[0];
     %>
     <% if (docs.length > 0) { %>
     <TR bgColor=#ffffff>
          <TD width="20%" class=text_searchbold valign="top">
               <img src=<%=ctx%>/images/arrow_blue.gif hspace=4>
               <b><trans:showPageMessage label="p6.docs" /></b>
          </TD>
          <TD width="80%" class=text_search valign="top">
               <%=(docs.length > 0) ? "" : unspecified%>
               <% for (int i = 0; i < docs.length; i++) { %>
                  <p>&middot;&nbsp;<%=docs[i].getTitle(lang_bean.language)%></p>
                  <% if (Utils.fileNameLooksLikePic(docs[i].getName())) { %>
                  <img src="<%=ctx%>/dbfile<%=docs[i].getRelativeLink()%>" border="1" width="200" />
                  <% } else {%>
                  <trans:showPageMessage label="p6.link" />:
                  <a target="previewdoc" href="<%=ctx%>/dbfile<%=docs[i].getRelativeLink()%>"><%=docs[i].getName()%></a>
                  <% } %>
               <% } %>
          </TD>
     </TR>
     <% } %>

     <%// relevant links %>
     <%
          AidaResource[] resources = bean.getResources();
          if (resources == null) resources = new AidaResource[0];
     %>
     <% if (resources.length > 0) { %>
     <TR bgColor=#ffffff>
          <TD width="20%" class=text_searchbold valign="center">
               <img src=<%=ctx%>/images/arrow_blue.gif hspace=4>
               <b><trans:showPageMessage label="p6.res" /></b>
          </TD>
          <TD width="80%" class=text_search valign="top">
               <%=(resources.length > 0) ? "" : unspecified%>
               <% for (int i = 0; i < resources.length; i++) { %>
                    &middot;&nbsp;<a href="<%=resources[i].getLink()%>"><%=resources[i].getTitle(lang_bean.language)%></a>
                    <p><%=resources[i].getDesc(lang_bean.language)%></p>
               <% } %>
          </TD>
     </TR>
     <% } %>

      <% if (bean.getLogo_url() != null) { %>
            <TR bgColor=#ffffff>
                  <TD width="20%" class=text_searchbold valign="center">
                        <img src=<%=ctx%>/images/arrow_blue.gif hspace=4>
                        <b><trans:showPageMessage label="p6.logo" /></b>
                  </TD>
                  <TD width="80%" class=text_search valign="top">
                        <img src="<%=ctx%>/dbfile<%=bean.getLogo_url()%>" border="1" />
                  </TD>
            </TR>
      <% } %>

      <% if (bean.getInfoSource() != null) { %>
            <TR bgColor=#ffffff>
                  <TD width="20%" class=text_searchbold valign="center">
                        <img src=<%=ctx%>/images/arrow_blue.gif hspace=4>
                        <b><trans:showPageMessage label="p6.infosource" /></b>
                  </TD>
                  <TD width="80%" class=text_search valign="top">
			   <%=bean.getInfoSource()%>
                  </TD>
            </TR>
      <% } %>

      <% if (aoo.isEnabled(ActObjsOptsConst.NOTEFIELDS)) { %>
		<% if (bean.getNoteField1(lang_bean.language) != null) { %>
            <TR bgColor=#ffffff>
                  <TD width="20%" class=text_searchbold valign="center">
                        <img src=<%=ctx%>/images/arrow_blue.gif hspace=4>
                        <b><trans:showPageMessage label="p.notefields" /></b><br/>
				    <trans:showPageMessage label="p7.notefield1" />
                  </TD>
                  <TD width="80%" class=text_search valign="top">
			   <%=bean.getNoteField1(lang_bean.language)%>
                  </TD>
            </TR>
		<% } %>
		<% if (bean.getNoteField2(lang_bean.language) != null) { %>
            <TR bgColor=#ffffff>
                  <TD width="20%" class=text_searchbold valign="center">
                        <img src=<%=ctx%>/images/arrow_blue.gif hspace=4>
                        <b><trans:showPageMessage label="p.notefields" /></b><br/>
				    <trans:showPageMessage label="p7.notefield2" />
                  </TD>
                  <TD width="80%" class=text_search valign="top">
			   <%=bean.getNoteField2(lang_bean.language)%>
                  </TD>
            </TR>
		<% } %>
		<% if (bean.getNoteField3(lang_bean.language) != null) { %>
            <TR bgColor=#ffffff>
                  <TD width="20%" class=text_searchbold valign="center">
                        <img src=<%=ctx%>/images/arrow_blue.gif hspace=4>
                        <b><trans:showPageMessage label="p.notefields" /></b><br/>
				    <trans:showPageMessage label="p7.notefield3" />
                  </TD>
                  <TD width="80%" class=text_search valign="top">
			   <%=bean.getNoteField3(lang_bean.language)%>
                  </TD>
            </TR>
		<% } %>
		<% if (bean.getNoteField4(lang_bean.language) != null) { %>
            <TR bgColor=#ffffff>
                  <TD width="20%" class=text_searchbold valign="center">
                        <img src=<%=ctx%>/images/arrow_blue.gif hspace=4>
                        <b><trans:showPageMessage label="p.notefields" /></b><br/>
				    <trans:showPageMessage label="p7.notefield4" />
                  </TD>
                  <TD width="80%" class=text_search valign="top">
			   <%=bean.getNoteField4(lang_bean.language)%>
                  </TD>
            </TR>
		<% } %>
	 <% } %>

<%      if (bean.getId()!=-1) { %>

       <TR bgColor=#ffffff>
                  <TD width="20%" class=text_searchbold valign="center">
                        <img src=<%=ctx%>/images/arrow_blue.gif hspace=4>
                        <b><trans:showPageMessage label="p6.editordetails" /></b>
                  </TD>

                  <TD width="80%" class=text_search valign="top">
      	     <a href=# onclick="javascript:window.open('<%=ctx%>/usr/view.jsp?id=<%=owner_id%>', 'user_viewer', 'status=yes,WIDTH=400,HEIGHT=200,scrollbars=YES');">    	
      	     	<trans:showPageMessage label="editordetails" />
      	     </a>
      	     , <trans:showPageMessage label="lastupdated" /> : <%=new java.sql.Date(bean.getObject().getDate_modif())%>
		      </TD>
    </tr>  
      
    <% } %>
      
</table>

<% if("yes".equals(print)) {%>
<script language="javascript">
print();
</script>
<script type="text/javascript" src="<html:rewrite page='/javascript/textCounter.js'/>"></script>
<%}%>